package drds.configuration.web.common.session_manager;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;

/**
 * @author caozhenghui@drds.team<330937205@qq.com>
 */
public class HttpSessionListener implements javax.servlet.http.HttpSessionListener {
    public void sessionCreated(HttpSessionEvent hse) {
    }

    public void sessionDestroyed(HttpSessionEvent hse) {
        HttpSession session = hse.getSession();
        /**
         * 如果用户登录了-需要从Session管理容器里面移除掉
         */
        if (session != null) {
            _ID_ _ID_ = (_ID_) session.getAttribute(SessionContextManager.ID);
            if (_ID_ != null) {
                Long id = _ID_.getId();
                if (id != null) {
                    SessionContextManager.removeSessionContent(id);
                }
            }
        }
    }

}
